package demoxsgl_300.com.gouwu1500.adapter;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import demoxsgl_300.com.gouwu1500.R;
import demoxsgl_300.com.gouwu1500.base.Base_Z_Adapter;
import demoxsgl_300.com.gouwu1500.base.MyApplication;
import demoxsgl_300.com.gouwu1500.bean.DangAn;


/**
 * Created by 他的猫 on 2016/12/3.
 * 适配器
 */

public class JianKang_Adapter extends Base_Z_Adapter {
    JianKang_Adapter.Holder holder;

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

        // 查找控件
        if (null == convertView) {
            convertView = LayoutInflater.from(MyApplication.getInstance())
                    .inflate(R.layout.tab_item_1_jiankang, null);
            holder = new JianKang_Adapter.Holder();
            holder.old = (TextView) convertView
                    .findViewById(R.id.old);
            holder.sex = (TextView) convertView
                    .findViewById(R.id.sex);
            holder.time = (TextView) convertView
                    .findViewById(R.id.time);
            holder.tv_bianzhengvalue = (TextView) convertView
                    .findViewById(R.id.tv_bianzhengvalue);
            holder.tv_bingzhengvalue = (TextView) convertView
                    .findViewById(R.id.tv_bingzhengvalue);
            // 缓存Holder
            convertView.setTag(holder);
        } else {
            holder = (JianKang_Adapter.Holder) convertView.getTag();
        }
        DangAn item = (DangAn) getItem(position);
        holder.old.setText(item.getOld());
        holder.sex.setText(item.getSex());
        holder.time.setText(""+item.getTime());

        holder.tv_bianzhengvalue.setText(item.getDialectical());

        holder.tv_bingzhengvalue.setText(item.getDisease());
        return convertView;
    }

    public class Holder {
        TextView old, sex, time,tv_bingzhengvalue,tv_bianzhengvalue;
        ImageView im_head;

    }
}
